<template>
	<view class="list">
		<view class="fixbg" :style="{'background-image': 'url(' + playList.coverImgUrl +' )'}"></view>
		<musichead title="歌单" :icon="true" color="white"></musichead>
		<view class="container" v-show="!isLoading">
			<scroll-view scroll-y="true">
				<view class="list-head">
					<view class="list-head-img">
						<image :src="playList.coverImgUrl"  mode=""></image>
						<text class="iconfont icon-bofang1">{{playList.playCount}}</text>
					</view>
					<view class="list-head-text">
						<view>
							{{playList.name}}
						</view>
						<view>
							<image :src="playList.creator.avatarUrl" mode=""></image>{{ playList.creator.nickname }}
						</view>
						<view>
							{{playList.description}}
						</view>
					</view>
				</view>
				<!-- #ifdef MP-WEIXIN -->
				<button class="share-button" open-type="share">
					<text class="iconfont icon-fenxiang"></text>分享给微信好友</button>
				<!-- #endif -->
				<!-- 音乐列表 -->
				<view class="list-music">
					<view class="list-music-head">
						<text class="iconfont icon-bofang"></text>
						<text>播放全部</text>
						<text>(共{{playList.trackCount}}首)</text>
					</view>
					<view class="list-music-item" v-for="(item, index) of playList.tracks" :key="index">
						<view class="list-music-top">
							{{index + 1}}
						</view>
						<view class="list-music-song">
							<view>
								{{item.name}}
							</view>
							<view>
								<!-- <image v-if="privileges[index].flag > 60 && privileges[index] < 70" src="/static/dujia.png" mode=""></image> -->
								<image v-if="privileges[index].flag > 2000000" src="/static/dujia.png" mode=""></image>
								<image v-if="privileges[index].maxbr == 999000" src="/static/sq.png" mode=""></image>
								{{item.ar[0].name}} - {{item.name}}
							</view>
						</view>
						<text class="iconfont icon-bofang1"></text>
					</view>
					<!-- <view class="list-music-item">
						<view class="list-music-top">
							1
						</view>
						<view class="list-music-song">
							<view>
								与我无关
							</view>
							<view>
								<image src="/static/logo.png" mode=""></image>
								<image src="/static/logo.png" mode=""></image>
								阿宇 - 与我无关
							</view>
						</view>
						<text class="iconfont icon-bofang1"></text>
					</view>
					<view class="list-music-item">
						<view class="list-music-top">
							1
						</view>
						<view class="list-music-song">
							<view>
								与我无关
							</view>
							<view>
								<image src="/static/logo.png" mode=""></image>
								<image src="/static/logo.png" mode=""></image>
								阿宇 - 与我无关
							</view>
						</view>
						<text class="iconfont icon-bofang1"></text>
					</view> -->
				</view>
			</scroll-view>
		</view>
	</view>
</template>

<script>
	import musichead from '@/components/musichead/musichead.vue'
	import {list} from '@/common/api.js'
	import {formatCount} from '../../utils/utils.js'
	export default {
		data() {
			return {
				playList: {
					creator:{
						avatarUrl:'',
						nickname: ''
					},
					coverImgUrl:'',
					playCount: '',
					name: '',
					description: '',
					trackCount: 0,
					tracks: []
				},
				privileges:[],
				isLoading: true,
				
			}
		},
		components: {
			musichead
		},
		methods: {

		},
		onLoad(options) {
			
			
			
			uni.showLoading({
				title:'正在加载......'
			})
			list(options.id).then((res) => {
				if(res.data.code == '200'){
					this.playList = res.data.playlist
					this.privileges = res.data.privileges
					this.playList.playCount = formatCount(res.data.playlist.playCount)
					this.isLoading = false;
					uni.hideLoading()
					console.log(res.data);
				}
			})
		}
	}
</script>

<style scoped>
	
	.list-head {
		display: flex;
		margin: 30rpx;
	}

	.list-head-img {
		width: 264rpx;
		height: 264rpx;
		border-radius: 30rpx;
		overflow: hidden;
		position: relative;
		margin-right: 42rpx;
	}

	.list-head-img image {
		width: 100%;
		height: 100%;
	}

	.list-head-img text {
		position: absolute;
		right: 8rpx;
		color: white;
		top: 8rpx;
		font-size: 26rpx;
	}

	.list-head-text {
		width: calc(100% - 30rpx - 264rpx - 30rpx);
		color: #f0f2f7;
	}

	.list-head-text view:nth-child(1) {
		color: white;
		font-size: 34rpx;
	}

	.list-head-text view:nth-child(2) {
		display: flex;
		margin: 20rpx 0;
		font-size: 24rpx;
		align-items: center;
	}

	.list-head-text view:nth-child(2) image {
		width: 54rpx;
		height: 54rpx;
		border-radius: 50%;
		overflow: hidden;
		margin-right: 14rpx;
	}

	.list-head-text view:nth-child(3) {
		line-height: 34rpx;
		font-size: 22rpx;
	}

	.share-button {
		width: 330rpx;
		height: 74rpx;
		margin: 0 auto;
		border-radius: 37rpx;
		background-color: rgba(0, 0, 0, 0.4);
		color: white;
		text-align: center;
		line-height: 74rpx;
		font-size: 28rpx;
	}

	.share-button text {
		margin-right: 16rpx;
	}
	
	.list-music{
		margin-top: 40rpx;
		background: rgba(255, 255, 255, 0.8);
		border-radius: 50rpx;
		overflow: hidden;
	}
	.list-music-head{
		height: 50rpx;
		margin: 30rpx 0 70rpx 22rpx;
	}
	.list-music-head text:nth-child(1){
		height: 50rpx;
		font-size: 50rpx;
	}
	.list-music-head text:nth-child(2){
		font-size: 30rpx;
		margin: 0 10rpx 0 26rpx;
	}
	.list-music-head text:nth-child(3){
		font-size: 26rpx;
		color: #b2b2b2
	}
	.list-music-item{
		display: flex;
		align-items: center;
		margin: 0 32rpx 66rpx 46rpx;
		color: #959595;
	}
	.list-music-top{
		width: 58rpx;
		font-size: 30rpx;
	}
	.list-music-song{
		flex: 1
	}
	.list-music-song view:nth-child(1){
		font-size: 28rpx;
		color: #000;
		width: 70vw;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}
	.list-music-song view:nth-child(2){
		font-size: 20rpx;
		align-items: center;
		width: 70vw;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
		
	}
	.list-music-song view:nth-child(2) image{
		width: 32rpx;
		height: 20rpx;
		margin-right: 10rpx;
		flex-shrink: 0;
	}
	.list-music-item text{
		font-size: 50rpx;
		color: #c7c7c7;
	}
</style>